<template>
	<view class="wrap">
		<view class="shadow"></view>
		<u-form class="form" :model="model" ref="uForm" label-position="left">
			<div class="tableTitle"><span class="midText">任务信息</span></div>
			<u-form-item label="任务类型" label-width="180"><u-input v-model="model.taskTypeName" disabled type="text"></u-input></u-form-item>
			<u-form-item label="任务标题" label-width="180"><u-input v-model="model.taskTitle" disabled type="textarea"></u-input></u-form-item>
			<u-form-item label="任务内容" label-width="180"><u-input v-model="model.taskContent" disabled type="textarea"></u-input></u-form-item>
			<u-form-item label="联系人" label-width="180"><u-input v-model="model.contactName" disabled type="text"></u-input></u-form-item>
			<u-form-item label="联系电话" label-width="180"><u-input v-model="model.contactPhone" disabled type="text"></u-input></u-form-item>
			<div class="tableTitle"><span class="midText">反馈信息</span></div>
			<u-form-item label="反馈截止时间" label-width="180"><u-input v-model="model.feedbackEndTimeStr" disabled type="text" maxlength="200"></u-input></u-form-item>
			<u-form-item label="最新进展情况" prop="feedbackContent" label-width="180" label-position="top">
				<u-input type="textarea" placeholder="请输入最新进展情况" disabled v-model="model.feedbackContent" height="100" maxlength="500" />
			</u-form-item>
			<u-form-item label="存在问题" label-width="180" label-position="top">
				<u-input type="textarea" placeholder="请输入存在问题" disabled v-model="model.feedbackAdvice" height="100" maxlength="500" />
			</u-form-item>
			<u-form-item label="拟采取的工作举措" label-width="180" label-position="top">
				<u-input type="textarea" placeholder="请输入拟采取的工作举措" disabled v-model="model.feedbackMeasure" height="100" maxlength="500" />
			</u-form-item>
			<u-form-item label="完成进度" prop="feedbackProgress" label-width="180">
				<js-radio v-model="model.feedbackProgress" dict-type="dc_feedback_progress"></js-radio>		
			</u-form-item>
			<u-form-item label="完成率" prop="feedbackRate" label-width="180">
				<u-input v-model="model.feedbackRate" disabled type="number" maxlength="10"></u-input>
				<span class="input-group-addon">%</span>
			</u-form-item>
			<u-form-item label="是否调度" label-width="180"><js-radio v-model="model.dispatchFlag" dict-type="sys_yes_no"></js-radio></u-form-item>
			<u-form-item v-if="model.dispatchFlag==1" label="选择调度" prop="feedbackDispatch" label-width="180">
				<js-radio v-model="model.feedbackDispatch" dict-type="dc_feedback_dispatch"></js-radio>		
			</u-form-item>
			<u-form-item label="反馈人" prop="feedbackName" label-width="180"><u-input v-model="model.feedbackName" disabled type="text" maxlength="200"></u-input></u-form-item>
			<u-form-item label="反馈人电话" prop="feedbackPhone" label-width="180">
				<u-input v-model="model.feedbackPhone" disabled type="text" maxlength="200"></u-input>
			</u-form-item>
			<!-- 附件 -->
				<view class="lh-mt-36 ipbox">
					<LhFilelist v-if="model.feedbackId" :bizKey="model.feedbackId" bizType="dcSupTaskFeedback_file" />
				</view>
		</u-form>
		<u-form class="form" :model="param" ref="uForm1" label-position="left">
					<u-modal v-model="show" title="审核意见" @cancel="cancel" @confirm="submitFalse" confirmText="确定" cancelText="取消" :show-cancel-button="true">
						<view class="u-update-content" style="margin-top: 20rpx">
							<textarea
								type="text"
								style="
						      width: 90%;
						      margin: auto;
						      height: 200rpx;
						      border: 1px solid #ccc;
						      font-size: 14px;
						    "
								v-model="param.auditOption"
								placeholder-class="line"
								maxlength="100"
								placeholder="文字限制在100字以内"
							/>
						</view>
					</u-modal>
				</u-form>
		<view class="form-footer" v-if="model.auditStatus == 1">
			<u-button class="btn" type="primary" @click="submit">通过</u-button>
			<u-button class="btn" type="error" @click="show1">驳回</u-button>
			<!-- <u-button class="btn" type="default" @click="cancel">关闭</u-button> -->
		</view>
	</view>
</template>
<script>
/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
import LhFilelist from '@/components/lh-filelist/lh-filelist.vue';
export default {
	components: {
		LhFilelist
	},
	data() {
		return {
			show: false,
			model: {
				id: '',
				taskTypeName: '',
				auditStatus:0
			},
			param: {
				feedbackProgress:'',
				id: '',
				targetId: '',
				targetType: '',
				dcSupTaskFeedback: {
					id: '',
					actionId: '',
					updateBy: ''
				},
				auditOption: '',
				auditResult: ''
			}
		};
	},
	onLoad(params) {
		params.taskYear = new Date().getFullYear()
		this.$u.api.auditFeedback.listFeedback(params).then(res => {
			Object.assign(this.model, res.list[0]);
		});
	},
	onReady() {},
	methods: {
		cancel() {},
		show1() {
					this.show = true;
				},
		submit() {
			//通过
			// this.param=this.model
			this.param.id = this.model.id;
			this.param.targetId = this.model.targetId;
			this.param.targetType = this.model.targetType;
			this.param.auditType = this.model.auditType;
			this.param.dcSupTaskFeedback.id = this.model.feedbackId;
			this.param.dcSupTaskFeedback.actionId = this.model.actionId;
			this.param.dcSupTaskFeedback.updateBy = this.model.updateBy;
			this.param.auditResult = 1;
			this.param.taskId = this.model.taskId;
			this.param.feedbackProgress = this.model.feedbackProgress;

			this.$u.api.auditFeedback.save(this.param).then(res => {
				uni.showModal({
					title: '提示',
					content: res.message,
					showCancel: false,
					success: function() {
						if (res.result == 'true') {
							uni.setStorageSync('refreshList', true);
							uni.navigateBack();
						}
					}
				});
			});
		},
		submitFalse() {
			//驳回
			// this.param=this.model
			this.param.id = this.model.id;
			this.param.targetId = this.model.targetId;
			this.param.taskId = this.model.taskId;
			this.param.targetType = this.model.targetType;
			this.param.auditType = this.model.auditType;
			this.param.dcSupTaskFeedback.id = this.model.feedbackId;
			this.param.dcSupTaskFeedback.actionId = this.model.actionId;
			this.param.dcSupTaskFeedback.updateBy = this.model.updateBy;
			this.param.auditResult = 2;
			this.param.feedbackProgress = this.model.feedbackProgress;
			this.$u.api.auditFeedback.save(this.param).then(res => {
				uni.showModal({
					title: '提示',
					content: res.message,
					showCancel: false,
					success: function() {
						if (res.result == 'true') {
							uni.setStorageSync('refreshList', true);
							uni.navigateBack();
						}
					}
				});
			});
		},
	}
};
</script>
<style lang="scss">
	.ipbox{
		z-index: 999;
	}
.shadow {
	position: fixed;
	top: 10%;
	width: 100%;
	height: 80%;
	z-index: 998;
	background-color: rgba(255, 255, 255, 0.1);
}
.u-cell{
	padding: 0px 0px!important;
}
.tableTitle {
    color: royalblue;
  }
.midText {
    left: 10%;
	font-style: italic;
    transform: translateX(-50%) translateY(-50%);
  }
</style>
